﻿module Parser

let isRange (block : string ) =
    block.Contains("-")
//
//let (|Character|) s =
//    if "abcdefghijklmnopqrstuvwxyzåäö".Contains(s)  then "aererererer"
//    else if "1234567890".Contains(s) then s
//    else ""

let FirstLast (s: char[]) = 
    (s.[0], s.[s.Length-1])

let getRange s = 
    let chrs = (s.ToString().ToCharArray())
    let (first, last) = FirstLast chrs
    "abcdefghijklmnopqrstuvwxyzåäö".ToString().ToCharArray() |>        
        Array.mapi(fun i x -> if x = first && x = last then x else char(0)) 

let ToSet s = 
    (s.ToString().ToCharArray()) |>
        Array.map(fun x -> x.ToString()) |>
            Set.ofArray 


let getPossibleCharacters s =
    Set.ofArray [|s|]

let parsePattern pattern = 
    "abcdefh"
